package com.opencore.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class FiltraServletNro
 */
@WebServlet("/FiltraServletNro")
public class FiltraServletNro extends HttpServlet {
	private static final long serialVersionUID = 1L;
	String nroDocInicio, nroDocFin;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public FiltraServletNro() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out = response.getWriter();
		if (request.getParameter("documentoD") != null) {
			nroDocInicio = request.getParameter("documentoD");
		}else{
			nroDocInicio = "0";
		}
		
		if (request.getParameter("documentoH") != null) {
			nroDocFin
			= request.getParameter("documentoH");
		}else{
			nroDocFin = "0";
		}		
		
	   if (nroDocInicio == "" && nroDocFin == ""){
		   request.setAttribute("datosOk", "DOC0");  
		   request.setAttribute("nroDocInicio", nroDocInicio);
		   request.setAttribute("nroDocFin", nroDocFin);
	   }else if (nroDocInicio != "" && nroDocFin == ""){
		   request.setAttribute("datosOk", "DOC1");  
		   request.setAttribute("nroDocInicio", nroDocInicio);
		   request.setAttribute("nroDocFin", nroDocFin);
	   }else if (nroDocInicio != "" && nroDocFin != ""){
		   request.setAttribute("datosOk", "DOC2");  
		   request.setAttribute("nroDocInicio", nroDocInicio);
		   request.setAttribute("nroDocFin", nroDocFin);
	   }
	  
	   
	   request.getRequestDispatcher("/visualizarDTENew.jsp").forward(request, response);
	}

}
